package org.fyp.synchrona.core.impl;

import org.fyp.synchrona.core.info.impl.CommonProfileObject;
import org.fyp.synchrona.services.BloggerProfiler;
import org.fyp.synchrona.services.MoodleProfiler;

public class ServiceManager {
	
	private static ServiceManager serviceManager;
	
	private ServiceManager(){
		
	}
	
	public static synchronized ServiceManager getServiceMangerObject(){
		if(serviceManager ==null){
			serviceManager=new ServiceManager();
			return serviceManager;
		}else{
			return serviceManager;
		}
	}
	
	public void updateServiceProfiles(CommonProfileObject cpo , String updataInitiator){
		if(updataInitiator.equals("facebook")){
			System.out.println("hello we are starting profile updates...");
			MoodleProfiler m = new MoodleProfiler();
			BloggerProfiler b = new BloggerProfiler();
			b.setCpo(cpo);
			m.setCpo(cpo);
			new Thread(m).start();
			System.out.println("updating Blogger");
			new Thread(b).start();
			
		}else if(updataInitiator.equals("twitter")){
			
		}else if(updataInitiator.equals("moodle")){
			
		}else if(updataInitiator.equals("blogger")){
			
		}
		
		
	}
}
